<?php
/**
 * @package qBase
 * @subpackage web
 */

/**
 * QWebEvent is the base of any browser event representation
 * 
 * @package qBase
 * @subpackage web
 */
class QWebEvent extends QEvent  
{
	const OnClick = 1;

	const TriggerAnyTime = 0;
	const TriggerAfterInit = 1;
	const TriggerBeforeLoad = 2;
	const TriggerAfterLoad = 3;
	
	private $trigger_time = self::TriggerAfterLoad;

	protected $url_group;

	public function __construct($type = null, $delegates = null, $url_group = null, $trigger_time = self::TriggerAfterLoad)
	{
		parent::__construct($type, $delegates);
		
		if ($trigger_time)
			$this->trigger_time = $trigger_time;
		
		if ($url_group)
			$this->setUrlGroup($url_group);
	}
	
	public function getTriggerTime()
	{
		return $this->trigger_time;
	}
	
	public function setTriggerTime($trigger_time)
	{
		$this->trigger_time = $trigger_time;
	}
	
	public function getUrlGroup()
	{
		if (isset($this->url_group))
			return $this->url_group;
		else 
			return null;
	}
	
	public function setUrlGroup($url_group)
	{
		if (isset($this->url_group) && $this->url_group && ($this->url_group != $url_group))
			throw new Exception("You can not change the URL group once it has been set");
		$this->url_group = $url_group;
	}
}


?>